package dao.impl;

import dao.IManagerDao;
import model.Manager;
import model.Order;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @aythor:侯仪澳
 * @data:2022/7/21
 */
@Repository
public class ManagerDao implements IManagerDao {
    @Autowired
    private SqlSession sqlSession;
    String url = "dao.IManagerDao.";

    //查询管理员
    @Override
    public List<Manager> queryAdmin(Manager manager) {
        return sqlSession.selectList(url + "queryAdmin",manager);
    }

    //超级管理员查询所有管理员用户
    @Override
    public List<Manager> queryAllAdmin(Map<String,Object> map) {
        List<Manager> list = sqlSession.selectList(url + "queryAllAdmin",map);
        return list;
    }

    //添加普通管理员
    @Override
    public int insertOneManager(Manager manager) {
        return sqlSession.insert(url + "insertOneManager",manager);
    }

    //修改普通管理员的权限
    @Override
    public int updateOneManager(Manager manager) {
        return sqlSession.update(url + "updateOneManager",manager);
    }
}
